import { lazy } from 'react'
const PickFolder = lazy(()=>import('#cpt/form-element/pick-folder'))
/* -------------------------------------------------------- Mongodb 备份 -- */
const Index = ({ database, backup }) => {
	return {
		modal:{
			title: <span>备份单个数据库</span>,
			width 	: '35%',
		},
		form: {
			labelWidth: 's6',
			api: 'mysql/backup_mongo',
			infoApi : false,
			param: { path:backup, database, name:database, pwd:'123456'},
			data: [
				{ label: '数据库', name:'database', r:1, type:'select', api:'project/database', idStr:'database', nameStr:'database', change:({ value, ref, row})=>{
					ref.setValue({ name: value, path: row.backup })
				} },
				{ label: '备份名称', name:'name', r:1 },
				{ label: '用户名', name:'username', r:1 },
				{ label: '密码', name:'pwd', type:'password', r:1 },
				{ label: '文件夹',  name: 'path', slot: v => <PickFolder {...v}/>, api:'/file/pick_folder',r:1},
			]
		}
	}
}
export default Index